require.config({
                baseUrl:"../",
               paths:{
               bsl:'bsl',
               
               }
               });
require(["bsl"],function(bsl){
        document.addEventListener('deviceready', onDeviceready, false);
        function onDeviceready(){
        alert("upload");
        var ft;
        function uploadFile() {
        
        var imageURI ='/Users/james/Desktop/aa.png';
        if(!imageURI)
        alert('请先选择本地图片');
        var options = new FileUploadOptions();
        options.fileKey = "file";
        options.fileName = imageURI.substr(imageURI.lastIndexOf('/') + 1);
        options.mimeType = "file/png";
        ft = new bsl.upload();
//        ft = new FileTransfer();

        
        ft.onprogress = function(progressEvent) {
        alert(progressEvent.loaded);
        if (progressEvent.lengthComputable) {
        loadingStatus.setPercentage(progressEvent.loaded / progressEvent.total);
        var  label=document.getElementById("progress");
        label.text=上传了+progressEvent.loaded+总计+progressEvent.total;
        } else {
        loadingStatus.increment();
        }
        };
        ft.upload(
                  imageURI,
//                  encodeURI('http://192.168.199.166:8000/uploads'),
                  encodeURI('ftp://114.215.197.65'),
                  function(){
                  console.log("上传网络图片成功");
                  },function(error){
                  console.log("上传网络图片出现错误");
                  },
                  options)
        }
        function abort(){
        ft.abort;
        
        }
        
        document.getElementById("startUpload").addEventListener("click", uploadFile, false);
        document.getElementById("abort").addEventListener("click", abort, false);
        
        }
        
        })